package com.aierkeji.call.b2c.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.aierkeji.call.b2c.entity.contants.CallResult;
import com.aierkeji.call.b2c.entity.contants.CallStatus;
import com.aierkeji.call.b2c.entity.contants.Gender;
import com.aierkeji.call.b2c.entity.snap.AkjCallUserSnap;

/**
 * 线索记录
 * 
 * @author 陈宇强
 *
 */

@Entity
@Table(name = "Akj_call_clue")
public class AkjCallClue {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", length = 32)
	private Long id;

	@Column(columnDefinition = "datetime")
	private Date createdAt;

	@ManyToOne(targetEntity = AkjCallUserSnap.class, fetch = FetchType.EAGER)
	@JoinColumn(name = "created_by", nullable = true)
	@NotFound(action = NotFoundAction.IGNORE)
	private AkjCallUserSnap createdBy;

	@ManyToOne(targetEntity = AkjCallClueGroup.class, fetch = FetchType.EAGER)
	@JoinColumn(name = "clue_group_id", nullable = true)
	@NotFound(action = NotFoundAction.IGNORE)
	private AkjCallClueGroup clueGroup;// 线索所属分组

	@Column(length = 13)
	private String phone;// 线索号码

	@Column(length = 32)
	private String name;// 线索名称

	@Column(length = 1)
	@Enumerated(EnumType.STRING)
	private Gender gender;// 性别

	@Column(length = 300)
	private String remark;// 导入线索时的备注

	@Column(length = 300)
	private String lastRemark;// 导入线索时的备注

	@ManyToOne(targetEntity = AkjCallUser.class, fetch = FetchType.EAGER)
	@JoinColumn(name = "assigned_to", nullable = true)
	@NotFound(action = NotFoundAction.IGNORE)
	private AkjCallUser assignedTo;// 线索分配到的下级

	@Column(columnDefinition = "datetime")
	private Date assignedAt;// 分配时间

	@Column(columnDefinition = "datetime")
	private Date lastCallAt;// 最新呼叫时间

	@Column()
	private Long lastCallTime;// 最新呼叫时长

	@Column(length = 10)
	@Enumerated(EnumType.STRING)
	private CallStatus lastCallStatus;// 最新呼叫状态

	@Column(length = 10)
	@Enumerated(EnumType.STRING)
	private CallResult lastCallResult;// 最新呼叫结果

	@Column(columnDefinition = "datetime")
	private Date recycledAt;// 最新回收时间

	@Transient
	private String phoneEncty;// 加密的手机号码

	@Column(columnDefinition = "datetime")
	private Date updatedAt;

	@ManyToOne(targetEntity = AkjCallUserSnap.class, fetch = FetchType.EAGER)
	@JoinColumn(name = "updated_by", nullable = true)
	@NotFound(action = NotFoundAction.IGNORE)
	private AkjCallUserSnap updatedBy;

	private String city;
	public Date getUpdatedAt() {
		return updatedAt;
	}

	public void setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
	}

	public AkjCallUserSnap getUpdatedBy() {
		return updatedBy;
	}

	public void setUpdatedBy(AkjCallUserSnap updatedBy) {
		this.updatedBy = updatedBy;
	}

	public String getPhoneEncty() {
		return phoneEncty;
	}

	public void setPhoneEncty(String phoneEncty) {
		this.phoneEncty = phoneEncty;
	}

	public String getLastRemark() {
		return lastRemark;
	}

	public void setLastRemark(String lastRemark) {
		this.lastRemark = lastRemark;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public AkjCallUserSnap getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(AkjCallUserSnap createdBy) {
		this.createdBy = createdBy;
	}

	public AkjCallClueGroup getClueGroup() {
		return clueGroup;
	}

	public void setClueGroup(AkjCallClueGroup clueGroup) {
		this.clueGroup = clueGroup;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public AkjCallUser getAssignedTo() {
		return assignedTo;
	}

	public void setAssignedTo(AkjCallUser assignedTo) {
		this.assignedTo = assignedTo;
	}

	public Date getAssignedAt() {
		return assignedAt;
	}

	public void setAssignedAt(Date assignedAt) {
		this.assignedAt = assignedAt;
	}

	public Date getLastCallAt() {
		return lastCallAt;
	}

	public void setLastCallAt(Date lastCallAt) {
		this.lastCallAt = lastCallAt;
	}

	public Long getLastCallTime() {
		return lastCallTime;
	}

	public void setLastCallTime(Long lastCallTime) {
		this.lastCallTime = lastCallTime;
	}

	public CallStatus getLastCallStatus() {
		return lastCallStatus;
	}

	public void setLastCallStatus(CallStatus lastCallStatus) {
		this.lastCallStatus = lastCallStatus;
	}

	public CallResult getLastCallResult() {
		return lastCallResult;
	}

	public void setLastCallResult(CallResult lastCallResult) {
		this.lastCallResult = lastCallResult;
	}

	public Date getRecycledAt() {
		return recycledAt;
	}

	public void setRecycledAt(Date recycledAt) {
		this.recycledAt = recycledAt;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

}
